import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RepeaterConfigVO, RepeaterConfigForm, RepeaterConfigQuery } from '@/api/business/repeaterConfig/types';

/**
 * 查询中继器配置列表
 * @param query
 * @returns {*}
 */

export const listRepeaterConfig = (query?: RepeaterConfigQuery): AxiosPromise<RepeaterConfigVO[]> => {
  return request({
    url: '/business/repeaterConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询中继器配置详细
 * @param id
 */
export const getRepeaterConfig = (id: string | number): AxiosPromise<RepeaterConfigVO> => {
  return request({
    url: '/business/repeaterConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增中继器配置
 * @param data
 */
export const addRepeaterConfig = (data: RepeaterConfigForm) => {
  return request({
    url: '/business/repeaterConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改中继器配置
 * @param data
 */
export const updateRepeaterConfig = (data: RepeaterConfigForm) => {
  return request({
    url: '/business/repeaterConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除中继器配置
 * @param id
 */
export const delRepeaterConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/repeaterConfig/' + id,
    method: 'delete'
  });
};
